package com.woniuxy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.woniuxy.domain.Room;
import com.woniuxy.mapper.RoomMapper;
import com.woniuxy.param.RoomParam;
import com.woniuxy.service.RoomService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wuyanzu
 * @since 2021-05-26
 */
@Service
public class RoomServiceImpl extends ServiceImpl<RoomMapper, Room> implements RoomService {

    @Override
    public List<Room> selectRoom(RoomParam roomParam) {
        if(roomParam==null){
            return this.list();
        }else{
            QueryWrapper<Room> wrapper = new QueryWrapper<>();
            if(roomParam.getRName()!=null)
                wrapper.eq("r_name",roomParam.getRName());
            if(roomParam.getRIntroduction()!=null)
                wrapper.eq("r_introduction",roomParam.getRIntroduction());
            if(roomParam.getRStatus()!=null)
                wrapper.eq("r_status",roomParam.getRStatus());
            return this.list(wrapper);
        }
    }
}
